package com.example.libbase.utils;

import android.content.Context;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * 读取配置文件工具类
 *
 * @author hermit
 * @date 2021/6/20 2:49
 */
public class PropertiesUtil {

    private static Properties props;

    public static void init(Context c) {
        props = new Properties();

        try {
//            File file = new File("/appConfig.properties");
//            InputStream in = new FileInputStream(file);
            InputStream in = c.getAssets().open("appConfig.properties");
            props.load(in);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static String getProperty(String key) {
        return props.getProperty(key);
    }
}